#!/usr/bin/expect


# 设置变量
set fileToCopy "edt-ft5x06.ko"
set fileToCopy_config "config.json"
set remoteHost "192.168.10.111"
set remoteDirectory "/home/cat/"
set username "cat"
set password "temppwd"

# Set the build commands
set makeClean "make clean"

set Make "make"


# Execute build commands

# spawn sh -c $makeClean
# expect {
	# "password:" { send "$password\r"; exp_continue }
	# eof
# }

# spawn sh -c $Make
# expect {
	# "password:" { send "$password\r"; exp_continue }
	# eof
# }

# =================APP====================
spawn chmod -R 777 $fileToCopy

# 执行scp命令
spawn scp $fileToCopy $username@$remoteHost:$remoteDirectory

# 期望看到密码提示
expect "password:"

# 发送密码
send "$password\r"

# =================config.json====================
#spawn chmod -R 777 $fileToCopy_config

# 执行scp命令
#spawn scp $fileToCopy_config $username@$remoteHost:$remoteDirectory

# 期望看到密码提示
#expect "password:"

# 发送密码
#send "$password\r"








# 等待命令执行完成
expect eof

